package day20170419.interfaces;

import org.junit.Test;

public class DaibuTest {
	@Test
	public void daiBuTest() throws Exception {
		
		//计算
		Add sum = new AddImpl();
		//算总数
		Sum carSum = new Car();
		// 汽车代步工具
		DaiBuGongJu daiBuGongJu = new Car();
		daiBuGongJu.run();
		//第一次赋值
		carSum.setX(100);
		carSum.setY(200);
		System.out.println(sum.add(carSum));

		// 马车代步工具
		DaiBuGongJu maChe = new MaChe();
		maChe.run();
		Sum maCheSum = new MaChe();
		//第二次赋值会把第一次给覆盖掉
		maCheSum.setX(0);
		maCheSum.setY(500);
		System.out.println(sum.add(maCheSum));
	}
}
